package com.jxnd.sunflower.utils;

import com.jxnd.sunflower.domain.RUser;
import com.jxnd.sunflower.domain.dto.UserDTO;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: 敷衍
 * @description: ThreadLocal 登录之后存放数据
 * @date: 2021/11/24 14:19
 * @version: 1.0
 */
public class LocalUser {
    private static ThreadLocal<UserDTO> threadLocal = new ThreadLocal<>();

    public static void set(UserDTO user) {

        LocalUser.threadLocal.set(user);
    }

    public static void clear() {
        LocalUser.threadLocal.remove();
    }

    public static UserDTO getUser() {
        UserDTO user = threadLocal.get();
        return user;
    }

}
